﻿using System;
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;

namespace corelib.Models
{
    public partial class JHWContext : DbContext
    {
        public virtual DbSet<JhAgent> JhAgent { get; set; }
        public virtual DbSet<JhAgentBankAccount> JhAgentBankAccount { get; set; }
        public virtual DbSet<JhAgentDepositGetApply> JhAgentDepositGetApply { get; set; }
        public virtual DbSet<JhAgentDepositRecord> JhAgentDepositRecord { get; set; }
        public virtual DbSet<JhAgentGoodsSaleInfo> JhAgentGoodsSaleInfo { get; set; }
        public virtual DbSet<JhAgentGrade> JhAgentGrade { get; set; }
        public virtual DbSet<JhArea> JhArea { get; set; }
        public virtual DbSet<JhCapitalSupplier> JhCapitalSupplier { get; set; }
        public virtual DbSet<JhCreditRecord> JhCreditRecord { get; set; }
        public virtual DbSet<JhFactory> JhFactory { get; set; }
        public virtual DbSet<JhFactoryAgentRelationship> JhFactoryAgentRelationship { get; set; }
        public virtual DbSet<JhFactoryAmmeter> JhFactoryAmmeter { get; set; }
        public virtual DbSet<JhFactoryAmmeterRecord> JhFactoryAmmeterRecord { get; set; }
        public virtual DbSet<JhFactoryBankAccount> JhFactoryBankAccount { get; set; }
        public virtual DbSet<JhFactoryComplaintAndSuggestion> JhFactoryComplaintAndSuggestion { get; set; }
        public virtual DbSet<JhFactoryDepositGetApply> JhFactoryDepositGetApply { get; set; }
        public virtual DbSet<JhFactoryDepositRecord> JhFactoryDepositRecord { get; set; }
        public virtual DbSet<JhFactoryOrder> JhFactoryOrder { get; set; }
        public virtual DbSet<JhFactoryOrderItem> JhFactoryOrderItem { get; set; }
        public virtual DbSet<JhFactoryOrderRecord> JhFactoryOrderRecord { get; set; }
        public virtual DbSet<JhFactoryPointRecord> JhFactoryPointRecord { get; set; }
        public virtual DbSet<JhFactoryPurchaseDemand> JhFactoryPurchaseDemand { get; set; }
        public virtual DbSet<JhFactoryReceiveAddress> JhFactoryReceiveAddress { get; set; }
        public virtual DbSet<JhFactoryRepaymentRecord> JhFactoryRepaymentRecord { get; set; }
        public virtual DbSet<JhGoodsBrandnoInfo> JhGoodsBrandnoInfo { get; set; }
        public virtual DbSet<JhGoodsGuidePrice> JhGoodsGuidePrice { get; set; }
        public virtual DbSet<JhGoodsInfo> JhGoodsInfo { get; set; }
        public virtual DbSet<JhMarket> JhMarket { get; set; }
        public virtual DbSet<JhMessage> JhMessage { get; set; }
        public virtual DbSet<JhOutsideTrade> JhOutsideTrade { get; set; }
        public virtual DbSet<JhPlatformDepositGetApply> JhPlatformDepositGetApply { get; set; }
        public virtual DbSet<JhPlatformDepositRecord> JhPlatformDepositRecord { get; set; }
        public virtual DbSet<JhPlatformInfo> JhPlatformInfo { get; set; }
        public virtual DbSet<JhSystemMessage> JhSystemMessage { get; set; }
        public virtual DbSet<SysDepartment> SysDepartment { get; set; }
        public virtual DbSet<SysLog> SysLog { get; set; }
        public virtual DbSet<SysMenu> SysMenu { get; set; }
        public virtual DbSet<SysParameter> SysParameter { get; set; }
        public virtual DbSet<SysParameterType> SysParameterType { get; set; }
        public virtual DbSet<SysPermission> SysPermission { get; set; }
        public virtual DbSet<SysRole> SysRole { get; set; }
        public virtual DbSet<SysRolePermission> SysRolePermission { get; set; }
        public virtual DbSet<SysRoleUser> SysRoleUser { get; set; }
        public virtual DbSet<SysUser> SysUser { get; set; }

        protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
        {
            #warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings.
            optionsBuilder.UseMySql(@"Server=58.58.180.48;port=33060;Database=jhw;password=jhw001;uid=root;");
        }

        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            modelBuilder.Entity<JhAgent>(entity =>
            {
                entity.HasKey(e => e.AgentId)
                    .HasName("PK_jh_agent");

                entity.ToTable("jh_agent");

                entity.Property(e => e.AgentId).HasColumnType("int(11)");

                entity.Property(e => e.Address)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.AgentName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.AgentStatus).HasColumnType("int(11)");

                entity.Property(e => e.AgentType).HasColumnType("int(11)");

                entity.Property(e => e.AreaId).HasColumnType("int(11)");

                entity.Property(e => e.AreaName)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CanGetDeposit)
                    .HasColumnType("decimal(10,2)")
                    .HasDefaultValueSql("0.00");

                entity.Property(e => e.CreateBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.Deposit)
                    .HasColumnType("decimal(10,2)")
                    .HasDefaultValueSql("0.00");

                entity.Property(e => e.DeviceNo).HasColumnType("varchar(256)");

                entity.Property(e => e.EditBy).HasColumnType("varchar(32)");

                entity.Property(e => e.EditTime).HasColumnType("datetime");

                entity.Property(e => e.FactoryCanGetDeposit)
                    .HasColumnType("decimal(10,2)")
                    .HasDefaultValueSql("0.00");

                entity.Property(e => e.FactoryFrozenDeposit)
                    .HasColumnType("decimal(10,2)")
                    .HasDefaultValueSql("0.00");

                entity.Property(e => e.FrozenDeposit)
                    .HasColumnType("decimal(10,2)")
                    .HasDefaultValueSql("0.00");

                entity.Property(e => e.GradeId).HasColumnType("int(11)");

                entity.Property(e => e.GradeName)
                    .IsRequired()
                    .HasColumnType("varchar(32)")
                    .HasDefaultValueSql("0");

                entity.Property(e => e.Latitude).HasColumnType("decimal(12,4)");

                entity.Property(e => e.LinkPhone)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.LoginPwd)
                    .IsRequired()
                    .HasColumnType("varchar(128)");

                entity.Property(e => e.Longitude).HasColumnType("decimal(12,4)");

                entity.Property(e => e.MarketId).HasColumnType("int(11)");

                entity.Property(e => e.MarketName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.MobileNo)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.Point)
                    .HasColumnType("int(11)")
                    .HasDefaultValueSql("0");

                entity.Property(e => e.Remark).HasColumnType("varchar(256)");
            });

            modelBuilder.Entity<JhAgentBankAccount>(entity =>
            {
                entity.HasKey(e => e.AccountId)
                    .HasName("PK_jh_agent_bank_account");

                entity.ToTable("jh_agent_bank_account");

                entity.Property(e => e.AccountId).HasColumnType("int(11)");

                entity.Property(e => e.AgentId).HasColumnType("int(11)");

                entity.Property(e => e.BankAccountName)
                    .IsRequired()
                    .HasColumnType("varchar(128)");

                entity.Property(e => e.BankAccountNo)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.BankName)
                    .IsRequired()
                    .HasColumnType("varchar(128)");

                entity.Property(e => e.CreateBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.EditBy).HasColumnType("varchar(32)");

                entity.Property(e => e.EditTime).HasColumnType("datetime");

                entity.Property(e => e.IsDefault).HasColumnType("bit(1)");
            });

            modelBuilder.Entity<JhAgentDepositGetApply>(entity =>
            {
                entity.HasKey(e => e.ApplyId)
                    .HasName("PK_jh_agent_deposit_get_apply");

                entity.ToTable("jh_agent_deposit_get_apply");

                entity.Property(e => e.ApplyId).HasColumnType("bigint(20)");

                entity.Property(e => e.AgentId).HasColumnType("int(11)");

                entity.Property(e => e.ApplyBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.ApplySum).HasColumnType("decimal(10,2)");

                entity.Property(e => e.ApplyTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.PayBy).HasColumnType("varchar(32)");

                entity.Property(e => e.PayTime).HasColumnType("datetime");

                entity.Property(e => e.Status).HasColumnType("int(11)");
            });

            modelBuilder.Entity<JhAgentDepositRecord>(entity =>
            {
                entity.HasKey(e => e.RecordId)
                    .HasName("PK_jh_agent_deposit_record");

                entity.ToTable("jh_agent_deposit_record");

                entity.Property(e => e.RecordId).HasColumnType("bigint(20)");

                entity.Property(e => e.AgentId).HasColumnType("int(11)");

                entity.Property(e => e.AgentName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.CanGetDeposit)
                    .HasColumnType("decimal(10,2)")
                    .HasDefaultValueSql("0.00");

                entity.Property(e => e.ChangeSum).HasColumnType("decimal(10,2)");

                entity.Property(e => e.ChangeTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.ChangeType).HasColumnType("int(11)");

                entity.Property(e => e.Deposit)
                    .HasColumnType("decimal(10,2)")
                    .HasDefaultValueSql("0.00");

                entity.Property(e => e.FactoryId).HasColumnType("int(11)");

                entity.Property(e => e.FactoryName).HasColumnType("varchar(64)");

                entity.Property(e => e.FrozenDeposit)
                    .HasColumnType("decimal(10,2)")
                    .HasDefaultValueSql("0.00");

                entity.Property(e => e.OperateBy).HasColumnType("varchar(32)");

                entity.Property(e => e.RelateBillNo).HasColumnType("varchar(32)");

                entity.Property(e => e.Remark).HasColumnType("varchar(256)");
            });

            modelBuilder.Entity<JhAgentGoodsSaleInfo>(entity =>
            {
                entity.HasKey(e => e.SaleInfoId)
                    .HasName("PK_jh_agent_goods_sale_info");

                entity.ToTable("jh_agent_goods_sale_info");

                entity.Property(e => e.SaleInfoId).HasColumnType("int(11)");

                entity.Property(e => e.AgentId).HasColumnType("int(11)");

                entity.Property(e => e.AreaId).HasColumnType("int(11)");

                entity.Property(e => e.AreaName)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.ArriveTime).HasColumnType("datetime");

                entity.Property(e => e.BrandNo)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CostPrice).HasColumnType("decimal(10,2)");

                entity.Property(e => e.CreateBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.EditBy).HasColumnType("varchar(32)");

                entity.Property(e => e.EditTime).HasColumnType("datetime");

                entity.Property(e => e.GoodsId).HasColumnType("int(11)");

                entity.Property(e => e.GoodsLeft).HasColumnType("decimal(10,2)");

                entity.Property(e => e.GoodsName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.GoodsSum).HasColumnType("decimal(10,2)");

                entity.Property(e => e.MarketId).HasColumnType("int(11)");

                entity.Property(e => e.MarketName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.Place).HasColumnType("varchar(32)");

                entity.Property(e => e.Remark).HasColumnType("varchar(1000)");

                entity.Property(e => e.SalePrice).HasColumnType("decimal(10,2)");

                entity.Property(e => e.Status).HasColumnType("int(11)");
            });

            modelBuilder.Entity<JhAgentGrade>(entity =>
            {
                entity.HasKey(e => e.GradeId)
                    .HasName("PK_jh_agent_grade");

                entity.ToTable("jh_agent_grade");

                entity.Property(e => e.GradeId).HasColumnType("int(11)");

                entity.Property(e => e.CostDiff)
                    .HasColumnType("int(11)")
                    .HasDefaultValueSql("0");

                entity.Property(e => e.CreateBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.EditBy).HasColumnType("varchar(32)");

                entity.Property(e => e.EditTime).HasColumnType("datetime");

                entity.Property(e => e.FactoryMaxAmount).HasColumnType("int(11)");

                entity.Property(e => e.FactoryMaxCredit).HasColumnType("int(11)");

                entity.Property(e => e.GradeName)
                    .IsRequired()
                    .HasColumnType("varchar(32)");
            });

            modelBuilder.Entity<JhArea>(entity =>
            {
                entity.HasKey(e => e.AreaId)
                    .HasName("PK_jh_area");

                entity.ToTable("jh_area");

                entity.Property(e => e.AreaId).HasColumnType("int(11)");

                entity.Property(e => e.AreaCode)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.AreaName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");
            });

            modelBuilder.Entity<JhCapitalSupplier>(entity =>
            {
                entity.HasKey(e => e.SupplierId)
                    .HasName("PK_jh_capital_supplier");

                entity.ToTable("jh_capital_supplier");

                entity.Property(e => e.SupplierId).HasColumnType("int(11)");

                entity.Property(e => e.Address).HasColumnType("varchar(128)");

                entity.Property(e => e.CreateBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.CreditPaied).HasColumnType("decimal(16,2)");

                entity.Property(e => e.CreditSum).HasColumnType("decimal(16,2)");

                entity.Property(e => e.DepositRate)
                    .HasColumnType("decimal(10,2)")
                    .HasDefaultValueSql("0.10");

                entity.Property(e => e.EditBy).HasColumnType("varchar(32)");

                entity.Property(e => e.EditTime).HasColumnType("datetime");

                entity.Property(e => e.IsUse)
                    .HasColumnType("bit(1)")
                    .HasDefaultValueSql("b'1'");

                entity.Property(e => e.LinkPhone).HasColumnType("varchar(32)");

                entity.Property(e => e.Linkman).HasColumnType("varchar(32)");

                entity.Property(e => e.PlatformDeposit).HasColumnType("decimal(16,2)");

                entity.Property(e => e.PlatformFrozenDeposit).HasColumnType("decimal(16,2)");

                entity.Property(e => e.Profit).HasColumnType("decimal(16,2)");

                entity.Property(e => e.ProfitRate).HasColumnType("decimal(4,2)");

                entity.Property(e => e.Remark).HasColumnType("varchar(256)");

                entity.Property(e => e.SupplierName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");
            });

            modelBuilder.Entity<JhCreditRecord>(entity =>
            {
                entity.HasKey(e => e.RecordId)
                    .HasName("PK_jh_credit_record");

                entity.ToTable("jh_credit_record");

                entity.Property(e => e.RecordId).HasColumnType("bigint(20)");

                entity.Property(e => e.BorrowTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.CreditSum)
                    .HasColumnType("decimal(10,2)")
                    .HasDefaultValueSql("0.00");

                entity.Property(e => e.FactoryId).HasColumnType("int(11)");

                entity.Property(e => e.FactoryName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.InterestRate).HasColumnType("decimal(4,2)");

                entity.Property(e => e.InterestSum).HasColumnType("decimal(10,2)");

                entity.Property(e => e.IsPenalty).HasColumnType("bit(1)");

                entity.Property(e => e.OrderNo)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.PenaltyRate).HasColumnType("decimal(4,2)");

                entity.Property(e => e.PenaltySum).HasColumnType("decimal(10,2)");

                entity.Property(e => e.PlanRepaymentSum).HasColumnType("decimal(10,2)");

                entity.Property(e => e.PlanRepaymentTime).HasColumnType("datetime");

                entity.Property(e => e.PlatformProfit).HasColumnType("decimal(10,2)");

                entity.Property(e => e.PlatformRate).HasColumnType("decimal(4,2)");

                entity.Property(e => e.Remark).HasColumnType("varchar(256)");

                entity.Property(e => e.Status).HasColumnType("int(11)");

                entity.Property(e => e.SupplierId).HasColumnType("int(11)");

                entity.Property(e => e.SupplierName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.SupplierProfit).HasColumnType("decimal(10,2)");

                entity.Property(e => e.SupplierRate).HasColumnType("decimal(4,2)");
            });

            modelBuilder.Entity<JhFactory>(entity =>
            {
                entity.HasKey(e => e.FactoryId)
                    .HasName("PK_jh_factory");

                entity.ToTable("jh_factory");

                entity.Property(e => e.FactoryId).HasColumnType("int(11)");

                entity.Property(e => e.ActualCredit).HasColumnType("decimal(10,2)");

                entity.Property(e => e.Address)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.AdviseCredit).HasColumnType("decimal(10,2)");

                entity.Property(e => e.AgentId).HasColumnType("int(11)");

                entity.Property(e => e.AgentName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.AmmeterDeposit).HasColumnType("int(11)");

                entity.Property(e => e.AreaId).HasColumnType("int(11)");

                entity.Property(e => e.AreaName)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CanGetDeposit)
                    .HasColumnType("decimal(10,2)")
                    .HasDefaultValueSql("0.00");

                entity.Property(e => e.CreateBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.DeviceNo).HasColumnType("varchar(256)");

                entity.Property(e => e.EditBy).HasColumnType("varchar(32)");

                entity.Property(e => e.EditTime).HasColumnType("datetime");

                entity.Property(e => e.FactoryGrade)
                    .HasColumnType("int(11)")
                    .HasDefaultValueSql("0");

                entity.Property(e => e.FactoryName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.FactoryOwner)
                    .IsRequired()
                    .HasColumnName("FActoryOwner")
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.FactoryStatus).HasColumnType("int(11)");

                entity.Property(e => e.FactoryType).HasColumnType("int(11)");

                entity.Property(e => e.FrozenDeposit)
                    .HasColumnType("decimal(10,2)")
                    .HasDefaultValueSql("0.00");

                entity.Property(e => e.HasOverdueLoan)
                    .HasColumnType("bit(1)")
                    .HasDefaultValueSql("b'0'");

                entity.Property(e => e.HasPowerAbnormalChange)
                    .HasColumnType("bit(1)")
                    .HasDefaultValueSql("b'0'");

                entity.Property(e => e.Intro).HasColumnType("varchar(256)");

                entity.Property(e => e.Latitude).HasColumnType("decimal(12,4)");

                entity.Property(e => e.LinkPhone)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.LoginPwd)
                    .IsRequired()
                    .HasColumnType("varchar(128)");

                entity.Property(e => e.Longitude).HasColumnType("decimal(12,4)");

                entity.Property(e => e.MarketId).HasColumnType("int(11)");

                entity.Property(e => e.MarketName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.MobileNo)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.MonthlyPowerEstimate).HasColumnType("decimal(10,2)");

                entity.Property(e => e.OfficialName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.OwnerIdNo)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.PayPwd)
                    .IsRequired()
                    .HasColumnType("varchar(128)");

                entity.Property(e => e.Point)
                    .HasColumnType("int(11)")
                    .HasDefaultValueSql("0");

                entity.Property(e => e.Remark).HasColumnType("varchar(256)");

                entity.Property(e => e.SupplierId).HasColumnType("int(11)");

                entity.Property(e => e.UsedCredit)
                    .HasColumnType("decimal(10,2)")
                    .HasDefaultValueSql("0.00");
            });

            modelBuilder.Entity<JhFactoryAgentRelationship>(entity =>
            {
                entity.HasKey(e => e.RelationId)
                    .HasName("PK_jh_factory_agent_relationship");

                entity.ToTable("jh_factory_agent_relationship");

                entity.Property(e => e.RelationId).HasColumnType("int(11)");

                entity.Property(e => e.CreateBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.DependenceId).HasColumnType("int(11)");

                entity.Property(e => e.DependenceName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.EditBy).HasColumnType("varchar(32)");

                entity.Property(e => e.EditTime).HasColumnType("datetime");

                entity.Property(e => e.Identity).HasColumnType("int(11)");

                entity.Property(e => e.PrimaryId).HasColumnType("int(11)");

                entity.Property(e => e.PrimaryName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.RelationType).HasColumnType("int(11)");

                entity.Property(e => e.Remark).HasColumnType("varchar(256)");
            });

            modelBuilder.Entity<JhFactoryAmmeter>(entity =>
            {
                entity.HasKey(e => e.AmmeterId)
                    .HasName("PK_jh_factory_ammeter");

                entity.ToTable("jh_factory_ammeter");

                entity.Property(e => e.AmmeterId).HasColumnType("int(11)");

                entity.Property(e => e.AmmeterNo)
                    .IsRequired()
                    .HasColumnType("varchar(128)");

                entity.Property(e => e.AreaId).HasColumnType("int(11)");

                entity.Property(e => e.AreaName)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CreateBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.EditBy).HasColumnType("varchar(32)");

                entity.Property(e => e.EditTime).HasColumnType("datetime");

                entity.Property(e => e.FactoryId).HasColumnType("int(11)");

                entity.Property(e => e.FactoryName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.InstallBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.InstallTime).HasColumnType("datetime");

                entity.Property(e => e.MarketId).HasColumnType("int(11)");

                entity.Property(e => e.MarketName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.Remark).HasColumnType("varchar(256)");

                entity.Property(e => e.StartTime).HasColumnType("datetime");
            });

            modelBuilder.Entity<JhFactoryAmmeterRecord>(entity =>
            {
                entity.HasKey(e => e.RecordId)
                    .HasName("PK_jh_factory_ammeter_record");

                entity.ToTable("jh_factory_ammeter_record");

                entity.Property(e => e.RecordId).HasColumnType("int(11)");

                entity.Property(e => e.AmmeterId).HasColumnType("int(11)");

                entity.Property(e => e.AmmeterNo)
                    .IsRequired()
                    .HasColumnType("varchar(128)");

                entity.Property(e => e.AreaId).HasColumnType("int(11)");

                entity.Property(e => e.AreaName)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.Consumption).HasColumnType("decimal(10,2)");

                entity.Property(e => e.EndTime).HasColumnType("datetime");

                entity.Property(e => e.FactoryId).HasColumnType("int(11)");

                entity.Property(e => e.FactoryName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.MarketId).HasColumnType("int(11)");

                entity.Property(e => e.MarketName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.RecordTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.StartTime).HasColumnType("datetime");
            });

            modelBuilder.Entity<JhFactoryBankAccount>(entity =>
            {
                entity.HasKey(e => e.AccountId)
                    .HasName("PK_jh_factory_bank_account");

                entity.ToTable("jh_factory_bank_account");

                entity.Property(e => e.AccountId).HasColumnType("int(11)");

                entity.Property(e => e.BankAccountName)
                    .IsRequired()
                    .HasColumnType("varchar(128)");

                entity.Property(e => e.BankAccountNo)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.BankName)
                    .IsRequired()
                    .HasColumnType("varchar(128)");

                entity.Property(e => e.CreateBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.EditBy).HasColumnType("varchar(32)");

                entity.Property(e => e.EditTime).HasColumnType("datetime");

                entity.Property(e => e.FactoryId).HasColumnType("int(11)");

                entity.Property(e => e.IsDefault).HasColumnType("bit(1)");
            });

            modelBuilder.Entity<JhFactoryComplaintAndSuggestion>(entity =>
            {
                entity.HasKey(e => e.RecordId)
                    .HasName("PK_jh_factory_complaint_and_suggestion");

                entity.ToTable("jh_factory_complaint_and_suggestion");

                entity.Property(e => e.RecordId).HasColumnType("int(11)");

                entity.Property(e => e.Content)
                    .IsRequired()
                    .HasColumnType("varchar(256)");

                entity.Property(e => e.CreateBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.FactoryId).HasColumnType("int(11)");

                entity.Property(e => e.FactoryName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.ReplyBy).HasColumnType("varchar(32)");

                entity.Property(e => e.ReplyContent).HasColumnType("varchar(256)");

                entity.Property(e => e.ReplyTime).HasColumnType("datetime");
            });

            modelBuilder.Entity<JhFactoryDepositGetApply>(entity =>
            {
                entity.HasKey(e => e.ApplyId)
                    .HasName("PK_jh_factory_deposit_get_apply");

                entity.ToTable("jh_factory_deposit_get_apply");

                entity.Property(e => e.ApplyId).HasColumnType("bigint(20)");

                entity.Property(e => e.AgentId).HasColumnType("int(11)");

                entity.Property(e => e.ApplyBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.ApplySum).HasColumnType("decimal(10,2)");

                entity.Property(e => e.ApplyTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.FactoryId).HasColumnType("int(11)");

                entity.Property(e => e.PayBy).HasColumnType("varchar(32)");

                entity.Property(e => e.PayTime).HasColumnType("datetime");

                entity.Property(e => e.Status).HasColumnType("int(11)");
            });

            modelBuilder.Entity<JhFactoryDepositRecord>(entity =>
            {
                entity.HasKey(e => e.RecordId)
                    .HasName("PK_jh_factory_deposit_record");

                entity.ToTable("jh_factory_deposit_record");

                entity.Property(e => e.RecordId).HasColumnType("bigint(20)");

                entity.Property(e => e.CanGetBalance).HasColumnType("decimal(10,2)");

                entity.Property(e => e.ChangeSum).HasColumnType("decimal(10,2)");

                entity.Property(e => e.ChangeTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.ChangeType).HasColumnType("int(11)");

                entity.Property(e => e.FactoryId).HasColumnType("int(11)");

                entity.Property(e => e.FactoryName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.FrozenBalance).HasColumnType("decimal(10,2)");

                entity.Property(e => e.OperateBy).HasColumnType("varchar(32)");

                entity.Property(e => e.RelateBillNo).HasColumnType("varchar(32)");

                entity.Property(e => e.Remark).HasColumnType("varchar(256)");
            });

            modelBuilder.Entity<JhFactoryOrder>(entity =>
            {
                entity.HasKey(e => e.OrderId)
                    .HasName("PK_jh_factory_order");

                entity.ToTable("jh_factory_order");

                entity.Property(e => e.OrderId).HasColumnType("bigint(20)");

                entity.Property(e => e.AddressId).HasColumnType("int(11)");

                entity.Property(e => e.AgentDeposit).HasColumnType("decimal(10,2)");

                entity.Property(e => e.AgentId).HasColumnType("int(11)");

                entity.Property(e => e.AgentName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.AreaId).HasColumnType("int(11)");

                entity.Property(e => e.AreaName)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CreateBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.CreateType).HasColumnType("int(255)");

                entity.Property(e => e.CreditSum)
                    .HasColumnType("decimal(10,2)")
                    .HasDefaultValueSql("0.00");

                entity.Property(e => e.DriverPhoneNo).HasColumnType("varchar(32)");

                entity.Property(e => e.FactoryDeposit).HasColumnType("decimal(10,2)");

                entity.Property(e => e.FactoryId).HasColumnType("int(11)");

                entity.Property(e => e.FactoryName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.GoodsPrice).HasColumnType("decimal(10,2)");

                entity.Property(e => e.MarketId).HasColumnType("int(11)");

                entity.Property(e => e.MarketName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.OrderNo)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.OrderStatus).HasColumnType("int(11)");

                entity.Property(e => e.OrderType).HasColumnType("int(11)");

                entity.Property(e => e.PayTime).HasColumnType("datetime");

                entity.Property(e => e.PlatformDeposit).HasColumnType("decimal(10,2)");

                entity.Property(e => e.PlatformProfit)
                    .HasColumnType("decimal(10,2)")
                    .HasDefaultValueSql("0.00");

                entity.Property(e => e.ReceivingRepoUrl).HasColumnType("varchar(128)");

                entity.Property(e => e.Remark).HasColumnType("varchar(1000)");

                entity.Property(e => e.Sum).HasColumnType("decimal(10,2)");

                entity.Property(e => e.SupplierProfit)
                    .HasColumnType("decimal(10,2)")
                    .HasDefaultValueSql("0.00");

                entity.Property(e => e.Tax)
                    .HasColumnType("decimal(10,2)")
                    .HasDefaultValueSql("0.00");

                entity.Property(e => e.TradeId).HasColumnType("int(11)");

                entity.Property(e => e.TruckLicensePlate).HasColumnType("varchar(32)");
            });

            modelBuilder.Entity<JhFactoryOrderItem>(entity =>
            {
                entity.HasKey(e => e.ItemId)
                    .HasName("PK_jh_factory_order_item");

                entity.ToTable("jh_factory_order_item");

                entity.Property(e => e.ItemId).HasColumnType("bigint(20)");

                entity.Property(e => e.AgentId).HasColumnType("int(11)");

                entity.Property(e => e.AgentName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.AreaId).HasColumnType("int(11)");

                entity.Property(e => e.AreaName)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.BrandNo)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.BuyAmount).HasColumnType("decimal(10,2)");

                entity.Property(e => e.CostPrice).HasColumnType("decimal(10,2)");

                entity.Property(e => e.FactoryId).HasColumnType("int(11)");

                entity.Property(e => e.FactoryName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.GoodsId).HasColumnType("int(11)");

                entity.Property(e => e.GoodsName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.MarketId).HasColumnType("int(11)");

                entity.Property(e => e.MarketName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.OrderId).HasColumnType("bigint(20)");

                entity.Property(e => e.Place).HasColumnType("varchar(32)");

                entity.Property(e => e.SalePrice).HasColumnType("decimal(10,2)");

                entity.Property(e => e.TradeId).HasColumnType("int(11)");
            });

            modelBuilder.Entity<JhFactoryOrderRecord>(entity =>
            {
                entity.HasKey(e => e.RecordId)
                    .HasName("PK_jh_factory_order_record");

                entity.ToTable("jh_factory_order_record");

                entity.Property(e => e.RecordId).HasColumnType("bigint(20)");

                entity.Property(e => e.ChangeTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.CurrentStatus).HasColumnType("int(11)");

                entity.Property(e => e.OperateBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.OrderId).HasColumnType("bigint(20)");

                entity.Property(e => e.OriginStatus).HasColumnType("int(11)");

                entity.Property(e => e.Remark).HasColumnType("varchar(256)");
            });

            modelBuilder.Entity<JhFactoryPointRecord>(entity =>
            {
                entity.HasKey(e => e.RecordId)
                    .HasName("PK_jh_factory_point_record");

                entity.ToTable("jh_factory_point_record");

                entity.Property(e => e.RecordId).HasColumnType("bigint(20)");

                entity.Property(e => e.Balance).HasColumnType("int(11)");

                entity.Property(e => e.BillId).HasColumnType("bigint(20)");

                entity.Property(e => e.BillNo).HasColumnType("varchar(32)");

                entity.Property(e => e.ChangeTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.ChangeType).HasColumnType("int(11)");

                entity.Property(e => e.FactoryId).HasColumnType("int(11)");

                entity.Property(e => e.FactoryName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.Point).HasColumnType("int(11)");

                entity.Property(e => e.Remark).HasColumnType("varchar(256)");
            });

            modelBuilder.Entity<JhFactoryPurchaseDemand>(entity =>
            {
                entity.HasKey(e => e.DemandId)
                    .HasName("PK_jh_factory_purchase_demand");

                entity.ToTable("jh_factory_purchase_demand");

                entity.Property(e => e.DemandId).HasColumnType("int(11)");

                entity.Property(e => e.AbateTime).HasColumnType("datetime");

                entity.Property(e => e.AreaId).HasColumnType("int(11)");

                entity.Property(e => e.AreaName)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.ArriveTime).HasColumnType("datetime");

                entity.Property(e => e.BrandNo)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.BuyPrice)
                    .HasColumnType("decimal(10,2)")
                    .HasDefaultValueSql("0.00");

                entity.Property(e => e.BuySum).HasColumnType("decimal(10,2)");

                entity.Property(e => e.CreateBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.DemandNo)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.Deposit)
                    .HasColumnType("decimal(10,2)")
                    .HasDefaultValueSql("0.00");

                entity.Property(e => e.EditBy).HasColumnType("varchar(32)");

                entity.Property(e => e.EditTime).HasColumnType("datetime");

                entity.Property(e => e.FactoryId).HasColumnType("int(11)");

                entity.Property(e => e.GoodsId).HasColumnType("int(11)");

                entity.Property(e => e.GoodsName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.MarketId).HasColumnType("int(11)");

                entity.Property(e => e.MarketName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.Place).HasColumnType("varchar(32)");

                entity.Property(e => e.Remark).HasColumnType("varchar(256)");

                entity.Property(e => e.Status).HasColumnType("int(11)");
            });

            modelBuilder.Entity<JhFactoryReceiveAddress>(entity =>
            {
                entity.HasKey(e => e.AddressId)
                    .HasName("PK_jh_factory_receive_address");

                entity.ToTable("jh_factory_receive_address");

                entity.Property(e => e.AddressId).HasColumnType("int(11)");

                entity.Property(e => e.Address)
                    .IsRequired()
                    .HasColumnType("varchar(128)");

                entity.Property(e => e.AreaCode)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.FactoryId).HasColumnType("int(11)");

                entity.Property(e => e.IsDefault).HasColumnType("bit(1)");

                entity.Property(e => e.LinkMan)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.LinkPhone)
                    .IsRequired()
                    .HasColumnType("varchar(32)");
            });

            modelBuilder.Entity<JhFactoryRepaymentRecord>(entity =>
            {
                entity.HasKey(e => e.RepaymentRecordId)
                    .HasName("PK_jh_factory_repayment_record");

                entity.ToTable("jh_factory_repayment_record");

                entity.Property(e => e.RepaymentRecordId).HasColumnType("bigint(20)");

                entity.Property(e => e.FactoryId).HasColumnType("int(11)");

                entity.Property(e => e.FactoryName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.LeftSum).HasColumnType("decimal(10,2)");

                entity.Property(e => e.OrderNo)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.Point).HasColumnType("int(11)");

                entity.Property(e => e.RecordId).HasColumnType("bigint(20)");

                entity.Property(e => e.Remark).HasColumnType("varchar(256)");

                entity.Property(e => e.RepaymentSum).HasColumnType("decimal(10,2)");

                entity.Property(e => e.RepaymentTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.RepaymentType).HasColumnType("int(11)");

                entity.Property(e => e.SupplierId).HasColumnType("int(11)");

                entity.Property(e => e.SupplierName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");
            });

            modelBuilder.Entity<JhGoodsBrandnoInfo>(entity =>
            {
                entity.HasKey(e => e.BrandNoId)
                    .HasName("PK_jh_goods_brandno_info");

                entity.ToTable("jh_goods_brandno_info");

                entity.Property(e => e.BrandNoId).HasColumnType("int(11)");

                entity.Property(e => e.BrandNo).HasColumnType("varchar(32)");

                entity.Property(e => e.CreateBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.EditBy).HasColumnType("varchar(32)");

                entity.Property(e => e.EditTime).HasColumnType("datetime");

                entity.Property(e => e.GoodsId).HasColumnType("int(11)");
            });

            modelBuilder.Entity<JhGoodsGuidePrice>(entity =>
            {
                entity.HasKey(e => e.PriceId)
                    .HasName("PK_jh_goods_guide_price");

                entity.ToTable("jh_goods_guide_price");

                entity.Property(e => e.PriceId).HasColumnType("int(11)");

                entity.Property(e => e.AreaId).HasColumnType("int(11)");

                entity.Property(e => e.AreaName)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.BrandNo)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CreateBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.EditBy).HasColumnType("varchar(32)");

                entity.Property(e => e.EditTime).HasColumnType("datetime");

                entity.Property(e => e.GoodsId).HasColumnType("int(11)");

                entity.Property(e => e.GoodsName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.GuidePrice).HasColumnType("decimal(10,2)");

                entity.Property(e => e.MarketId).HasColumnType("int(11)");

                entity.Property(e => e.MarketName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.Place).HasColumnType("varchar(32)");

                entity.Property(e => e.Remark).HasColumnType("varchar(256)");
            });

            modelBuilder.Entity<JhGoodsInfo>(entity =>
            {
                entity.HasKey(e => e.GoodsId)
                    .HasName("PK_jh_goods_info");

                entity.ToTable("jh_goods_info");

                entity.Property(e => e.GoodsId).HasColumnType("int(11)");

                entity.Property(e => e.CreateBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.EditBy).HasColumnType("varchar(32)");

                entity.Property(e => e.EditTime).HasColumnType("datetime");

                entity.Property(e => e.GoodsName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.Remark).HasColumnType("varchar(256)");
            });

            modelBuilder.Entity<JhMarket>(entity =>
            {
                entity.HasKey(e => e.MarketId)
                    .HasName("PK_jh_market");

                entity.ToTable("jh_market");

                entity.Property(e => e.MarketId).HasColumnType("int(11)");

                entity.Property(e => e.AreaId).HasColumnType("int(11)");

                entity.Property(e => e.AreaName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.CreateBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.EditBy).HasColumnType("varchar(32)");

                entity.Property(e => e.EditTime).HasColumnType("datetime");

                entity.Property(e => e.MarketName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");
            });

            modelBuilder.Entity<JhMessage>(entity =>
            {
                entity.HasKey(e => e.MessageId)
                    .HasName("PK_jh_message");

                entity.ToTable("jh_message");

                entity.Property(e => e.MessageId).HasColumnType("int(11)");

                entity.Property(e => e.Content)
                    .IsRequired()
                    .HasColumnType("varchar(256)");

                entity.Property(e => e.CreateBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.ReadTime).HasColumnType("datetime");

                entity.Property(e => e.ReceiverId).HasColumnType("int(11)");

                entity.Property(e => e.ReceiverType).HasColumnType("int(11)");

                entity.Property(e => e.SendTime).HasColumnType("datetime");

                entity.Property(e => e.SenderId).HasColumnType("int(11)");

                entity.Property(e => e.SenderType).HasColumnType("int(11)");

                entity.Property(e => e.Status).HasColumnType("int(11)");

                entity.Property(e => e.Title).HasColumnType("varchar(64)");
            });

            modelBuilder.Entity<JhOutsideTrade>(entity =>
            {
                entity.HasKey(e => e.TradeId)
                    .HasName("PK_jh_outside_trade");

                entity.ToTable("jh_outside_trade");

                entity.Property(e => e.TradeId).HasColumnType("int(11)");

                entity.Property(e => e.Address)
                    .IsRequired()
                    .HasColumnType("varchar(128)");

                entity.Property(e => e.BankAccountName)
                    .IsRequired()
                    .HasColumnType("varchar(128)");

                entity.Property(e => e.BankAccountNo)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.BankName)
                    .IsRequired()
                    .HasColumnType("varchar(128)");

                entity.Property(e => e.CreateBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.EditBy).HasColumnType("varchar(32)");

                entity.Property(e => e.EditTime).HasColumnType("datetime");

                entity.Property(e => e.FactoryId).HasColumnType("int(11)");

                entity.Property(e => e.FactoryName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.IsDefault).HasColumnType("bit(1)");

                entity.Property(e => e.LinkPhone)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.Linkman)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.TradeName)
                    .IsRequired()
                    .HasColumnType("varchar(128)");
            });

            modelBuilder.Entity<JhPlatformDepositGetApply>(entity =>
            {
                entity.HasKey(e => e.ApplyId)
                    .HasName("PK_jh_platform_deposit_get_apply");

                entity.ToTable("jh_platform_deposit_get_apply");

                entity.Property(e => e.ApplyId).HasColumnType("int(11)");

                entity.Property(e => e.ApplyBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.ApplySum).HasColumnType("decimal(10,2)");

                entity.Property(e => e.ApplyTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.PayBy).HasColumnType("varchar(32)");

                entity.Property(e => e.PayTime).HasColumnType("datetime");

                entity.Property(e => e.Status).HasColumnType("int(11)");

                entity.Property(e => e.SupplierId).HasColumnType("int(11)");

                entity.Property(e => e.SupplierName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");
            });

            modelBuilder.Entity<JhPlatformDepositRecord>(entity =>
            {
                entity.HasKey(e => e.RecordId)
                    .HasName("PK_jh_platform_deposit_record");

                entity.ToTable("jh_platform_deposit_record");

                entity.Property(e => e.RecordId).HasColumnType("bigint(20)");

                entity.Property(e => e.ChangeSum).HasColumnType("decimal(10,2)");

                entity.Property(e => e.ChangeTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.ChangeType).HasColumnType("int(11)");

                entity.Property(e => e.FactoryId).HasColumnType("int(11)");

                entity.Property(e => e.FactoryName).HasColumnType("varchar(64)");

                entity.Property(e => e.PlatformDeposit).HasColumnType("decimal(16,2)");

                entity.Property(e => e.PlatformFrozenDeposit).HasColumnType("decimal(16,2)");

                entity.Property(e => e.RelateBillNo).HasColumnType("varchar(32)");

                entity.Property(e => e.Remark).HasColumnType("varchar(256)");

                entity.Property(e => e.SupplierId).HasColumnType("int(11)");

                entity.Property(e => e.SupplierName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");
            });

            modelBuilder.Entity<JhPlatformInfo>(entity =>
            {
                entity.HasKey(e => e.PrimaryId)
                    .HasName("PK_jh_platform_info");

                entity.ToTable("jh_platform_info");

                entity.Property(e => e.PrimaryId).HasColumnType("int(11)");

                entity.Property(e => e.AgentCanGetDeposit).HasColumnType("decimal(16,2)");

                entity.Property(e => e.AgentDeposit).HasColumnType("decimal(16,2)");

                entity.Property(e => e.AgentFrozenDeposit).HasColumnType("decimal(16,2)");

                entity.Property(e => e.CanGetProfit).HasColumnType("decimal(16,2)");

                entity.Property(e => e.PlatformDeposit).HasColumnType("decimal(16,2)");

                entity.Property(e => e.PlatformFrozenDeposit).HasColumnType("decimal(16,2)");

                entity.Property(e => e.ProfitSum).HasColumnType("decimal(16,2)");
            });

            modelBuilder.Entity<JhSystemMessage>(entity =>
            {
                entity.HasKey(e => e.MessageId)
                    .HasName("PK_jh_system_message");

                entity.ToTable("jh_system_message");

                entity.Property(e => e.MessageId).HasColumnType("int(11)");

                entity.Property(e => e.Content)
                    .IsRequired()
                    .HasColumnType("varchar(256)");

                entity.Property(e => e.MessageStatus).HasColumnType("int(11)");

                entity.Property(e => e.MessageUrl)
                    .IsRequired()
                    .HasColumnType("varchar(128)");

                entity.Property(e => e.ReadTime).HasColumnType("datetime");

                entity.Property(e => e.Receiver)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.SendTime).HasColumnType("datetime");

                entity.Property(e => e.Title)
                    .IsRequired()
                    .HasColumnType("varchar(64)");
            });

            modelBuilder.Entity<SysDepartment>(entity =>
            {
                entity.HasKey(e => e.DepartmentId)
                    .HasName("PK_sys_department");

                entity.ToTable("sys_department");

                entity.Property(e => e.DepartmentId).HasColumnType("int(11)");

                entity.Property(e => e.CreateBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.DepartmentName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.EditBy).HasColumnType("varchar(32)");

                entity.Property(e => e.EditTime).HasColumnType("datetime");

                entity.Property(e => e.Leader)
                    .IsRequired()
                    .HasColumnType("varchar(32)");
            });

            modelBuilder.Entity<SysLog>(entity =>
            {
                entity.HasKey(e => e.LogId)
                    .HasName("PK_sys_log");

                entity.ToTable("sys_log");

                entity.Property(e => e.LogId).HasColumnType("bigint(20)");

                entity.Property(e => e.BillId).HasColumnType("bigint(20)");

                entity.Property(e => e.BillNo).HasColumnType("varchar(32)");

                entity.Property(e => e.Content)
                    .IsRequired()
                    .HasColumnType("varchar(1024)");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.ErrorType).HasColumnType("varchar(256)");

                entity.Property(e => e.LogBy).HasColumnType("varchar(32)");

                entity.Property(e => e.LogType).HasColumnType("int(11)");

                entity.Property(e => e.ObjId).HasColumnType("bigint(20)");

                entity.Property(e => e.ObjType).HasColumnType("int(11)");

                entity.Property(e => e.Position).HasColumnType("varchar(256)");
            });

            modelBuilder.Entity<SysMenu>(entity =>
            {
                entity.HasKey(e => e.MenuCode)
                    .HasName("PK_sys_menu");

                entity.ToTable("sys_menu");

                entity.Property(e => e.MenuCode).HasColumnType("varchar(16)");

                entity.Property(e => e.CreateBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.EditBy).HasColumnType("varchar(32)");

                entity.Property(e => e.EditTime).HasColumnType("datetime");

                entity.Property(e => e.IsDisplay)
                    .HasColumnType("bit(1)")
                    .HasDefaultValueSql("b'1'");

                entity.Property(e => e.MenuName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.ParentCode).HasColumnType("varchar(16)");

                entity.Property(e => e.SortId).HasColumnType("smallint(6)");

                entity.Property(e => e.Url).HasColumnType("varchar(128)");
            });

            modelBuilder.Entity<SysParameter>(entity =>
            {
                entity.HasKey(e => e.ParameterId)
                    .HasName("PK_sys_parameter");

                entity.ToTable("sys_parameter");

                entity.Property(e => e.ParameterId).HasColumnType("int(11)");

                entity.Property(e => e.CreateBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.EditBy).HasColumnType("varchar(32)");

                entity.Property(e => e.EditTime).HasColumnType("datetime");

                entity.Property(e => e.ParameterCode).HasColumnType("int(11)");

                entity.Property(e => e.ParameterName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.ParameterValue).HasColumnType("decimal(12,2)");

                entity.Property(e => e.Remark).HasColumnType("varchar(256)");

                entity.Property(e => e.TypeId).HasColumnType("int(11)");

                entity.Property(e => e.TypeNo).HasColumnType("varchar(32)");
            });

            modelBuilder.Entity<SysParameterType>(entity =>
            {
                entity.HasKey(e => e.TypeId)
                    .HasName("PK_sys_parameter_type");

                entity.ToTable("sys_parameter_type");

                entity.Property(e => e.TypeId).HasColumnType("int(11)");

                entity.Property(e => e.CreateBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.EditBy).HasColumnType("varchar(32)");

                entity.Property(e => e.EditTime).HasColumnType("datetime");

                entity.Property(e => e.TypeName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.TypeNo)
                    .IsRequired()
                    .HasColumnType("varchar(32)");
            });

            modelBuilder.Entity<SysPermission>(entity =>
            {
                entity.HasKey(e => e.PermissionId)
                    .HasName("PK_sys_permission");

                entity.ToTable("sys_permission");

                entity.Property(e => e.PermissionId).HasColumnType("int(11)");

                entity.Property(e => e.ActionName).HasColumnType("varchar(128)");

                entity.Property(e => e.AreaName).HasColumnType("varchar(128)");

                entity.Property(e => e.ControllerName).HasColumnType("varchar(128)");

                entity.Property(e => e.CreateBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)")
                    .HasDefaultValueSql("0");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.EditBy).HasColumnType("varchar(32)");

                entity.Property(e => e.EditTime).HasColumnType("datetime");

                entity.Property(e => e.MenuCode).HasColumnType("varchar(16)");

                entity.Property(e => e.PermissionName)
                    .IsRequired()
                    .HasColumnType("varchar(128)");
            });

            modelBuilder.Entity<SysRole>(entity =>
            {
                entity.HasKey(e => e.RoleId)
                    .HasName("PK_sys_role");

                entity.ToTable("sys_role");

                entity.Property(e => e.RoleId).HasColumnType("int(11)");

                entity.Property(e => e.CreateBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.EditBy).HasColumnType("varchar(32)");

                entity.Property(e => e.EditTime).HasColumnType("datetime");

                entity.Property(e => e.RoleName)
                    .IsRequired()
                    .HasColumnType("varchar(128)");
            });

            modelBuilder.Entity<SysRolePermission>(entity =>
            {
                entity.HasKey(e => e.RolePermissionId)
                    .HasName("PK_sys_role_permission");

                entity.ToTable("sys_role_permission");

                entity.Property(e => e.RolePermissionId).HasColumnType("int(11)");

                entity.Property(e => e.CreateBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.EditBy).HasColumnType("varchar(32)");

                entity.Property(e => e.EditTime).HasColumnType("datetime");

                entity.Property(e => e.PermissionId).HasColumnType("int(11)");

                entity.Property(e => e.RoleId).HasColumnType("int(11)");
            });

            modelBuilder.Entity<SysRoleUser>(entity =>
            {
                entity.HasKey(e => e.RoleUserId)
                    .HasName("PK_sys_role_user");

                entity.ToTable("sys_role_user");

                entity.Property(e => e.RoleUserId).HasColumnType("int(11)");

                entity.Property(e => e.CreateBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.EditBy).HasColumnType("varchar(32)");

                entity.Property(e => e.EditTime).HasColumnType("datetime");

                entity.Property(e => e.RoleId).HasColumnType("int(11)");

                entity.Property(e => e.UserId).HasColumnType("int(11)");
            });

            modelBuilder.Entity<SysUser>(entity =>
            {
                entity.HasKey(e => e.UserId)
                    .HasName("PK_sys_user");

                entity.ToTable("sys_user");

                entity.Property(e => e.UserId).HasColumnType("int(11)");

                entity.Property(e => e.CreateBy)
                    .IsRequired()
                    .HasColumnType("varchar(32)");

                entity.Property(e => e.CreateTime)
                    .HasColumnType("datetime")
                    .HasDefaultValueSql("CURRENT_TIMESTAMP");

                entity.Property(e => e.DepartmentId).HasColumnType("int(11)");

                entity.Property(e => e.DepartmentName)
                    .IsRequired()
                    .HasColumnType("varchar(64)");

                entity.Property(e => e.EditBy).HasColumnType("varchar(32)");

                entity.Property(e => e.EditTime).HasColumnType("datetime");

                entity.Property(e => e.Email).HasColumnType("varchar(256)");

                entity.Property(e => e.Password)
                    .IsRequired()
                    .HasColumnType("varchar(128)");

                entity.Property(e => e.Phone).HasColumnType("varchar(32)");

                entity.Property(e => e.Sex).HasColumnType("int(11)");

                entity.Property(e => e.Status).HasColumnType("int(11)");

                entity.Property(e => e.UserCode).HasColumnType("varchar(32)");

                entity.Property(e => e.UserName)
                    .IsRequired()
                    .HasColumnType("varchar(32)");
            });
        }
    }
}